package com.example.springdemo.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

public class AspectByXml {

    public void myBefore(JoinPoint joinPoint) {
        System.out.println("前置通知**");
        System.out.println("增强的目标是：" + joinPoint.getSignature().getName());
    }

    public Object myAround(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("环绕通知开始***");
        Object obj = joinPoint.proceed();
        System.out.println("环绕通知结束***");
        return obj;
    }

    public void myAfterReturn(JoinPoint joinPoint) {
        System.out.println("后置返回通知***");
    }

    public void myAfterFinal(JoinPoint joinPoint) {
        System.out.println("后置最终通知****");
    }

    public void myException(JoinPoint joinPoint,Throwable e) {
        System.out.println("异常通知***");
        System.out.println("异常信息=" +e.getMessage());
    }
}
